<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>LAMP圣才-列表页</title>

</head>
<link rel="stylesheet" href="../public/home/css/details.css">
<body>
<!--顶部条-->
<?php require "./foot/header.php"; ?>

<!--大盒子-->
<div id="big">
    <!--顶部搜索条-->
    <div id="search">
        <form action="#" method="post">
            <input type="text" placeholder="让学习成为一种习惯!" name=""/>
            <select name="">
                <option value="1">帖子</option>
                <option value="2">日志</option>
                <option value="3">用户</option>
                <option value="4">板块</option>
            </select>
            <input type="submit" value="搜索"/>
        </form>
        <ul id="hot">
            <li>热搜：</li>
            <li class="red">php</li>
            <li class="red">php视频</li>
            <li class="red">php教程</li>
        </ul>
        <div id="guanzhu">
            <ul>
                <li><a href="#"><img src="../public/home/img/sina_n.png" title="关注新浪微博"/></a></li>
                <li><a href="#"><img src="../public/home/img/qq_n.png" title="添加到QQ"/></a></li>
                <li><a href="#"><img src="../public/home/img/6.gif" title="添加笔记"/></a></li>
                <li><a href="#"><img src="../public/home/img/21.gif" title="百度浏览"/></a></li>
                <li><a href="#"><img src="../public/home/img/medal.png" title="排行榜"/></a></li>
            </ul>
        </div>
    </div>
    <!--顶部搜索条结束-->
    <?php
    $pid = $_GET['pid'];//post标题的id
    $id = $_GET['id'];//这是类的ID
    $username = $_GET['username'];
    $title = $_GET['title'];//post 的标题
    $content = $_GET['content'];//post 的内容
//    			var_dump($username);
//    			die;
    $link = mysqli_connect("localhost", "root", "") or die("数据连接失败");
    mysqli_set_charset($link, "utf8");
    mysqli_select_db($link, "bbs");
    $sql = "select * from  type where id={$id}";
    $res = mysqli_query($link, $sql);
    if ($res && mysqli_num_rows($res) > 0) {
        while ($rows = mysqli_fetch_assoc($res)) {


            ?>

            <!--引导层开始-->
            <div id="yindao">
                <p><a href="#">LAMP圣才</a> > <a href="#"><?php echo $rows['name']; ?></a>
                    <a href="#">欢迎来到<?php echo $title; ?>..</a></p>
            </div>
            <!--引导层结束-->

            <!--分页开始-->
            <div id="list">
                <div id="page">
                    <div id="pagefy">
                        <ul>
                            <li><a href="#">< 返回列表</a></li>
                            <li><a href="#">1</a></li>
                            <li><a href="#">2</a></li>
                            <li><a href="#">3</a></li>
                            <li><a href="#">4</a></li>
                            <li><a href="#">5</a></li>
                            <li><a href="#">6</a></li>
                            <li><a href="#">…537</a></li>
                            <li><a href="#">下一页 ></a></li>
                        </ul>
                    </div>
                    <div id="fatie">

                        <button image="../public/home/img/fatie.png"><a
                                href="./requestjs/reply.php?a=reply&id=<?php echo $id; ?>&pid=<?php echo $pid; ?>&username=<?php echo $username?>&title=<?php echo $title; ?>&content=<?php echo $content; ?>">回复</a>
                        </button>

                        <a href="#">
                            <button image="../public/home/img/fatie.png">发帖</button>
                        </a>
                    </div>
                </div>
            </div>
            <!--分页结束-->

            <!--楼主帖子详情结束-->
            <div id="bigdetail">
                <div id="detail">
                    <div id="lzinfo">
                        <div id="read">
                            <p>29585</p>

                            <p>阅读</p>
                        </div>
                        <div id="reply">
                            <p>641</p>

                            <p>回复</p>
                        </div>
                        <div id="lztoux">
                            <div id="uname">
                                <a href="#"><?php echo $username;?></a>
                            </div>
                            <div id="utoux">
                                <img src="../public/home/img/utoux.png"/>
                            </div>
                            <div id="ulevel">
                                <a href="#">上士</a><br/>
                                <img src="../public/home/img/jindu.png"/>
                            </div>
                            <div id="uhuiz">
                                <a href="#"><img src="../public/home/img/huiz.png"/></a>
                            </div>
                            <div id="uguanz">
                                <a href="#" class="jia">加关注</a>
                                <a href="#" class="fa">发消息</a>
                            </div>
                        </div>
                    </div>
                    <div id="tzinfo">
                        <div id="tzbiaot">
                            <p><?php echo $title; ?><span><a href="#">[复制链接]</a></span></p>
                        </div>
                        <div id="tzxiangq">
                            <div id="fttime">
                                <p>楼主 发表于:2016-02-19</p>
                                <ul>
                                    <li><a href="#">只看楼主</a></li>
                                    <li><a href="#">倒叙阅读</a></li>
                                    <li><a href="#">使用道具</a></li>
                                </ul>
                            </div>
                            <div id="tzneir">
                                <p><?php echo $content; ?></p>
                            </div>
                            <div id="tzfenx">
                                <a href="#"><img src="../public/home/img/wechat.png"/></a>
                                <a href="#"><img src="../public/home/img/QQ.png"/></a>
                                <a href="#"><img src="../public/home/img/qzone.png"/></a>
                                <a href="#"><img src="../public/home/img/weibo.png"/></a>
                            </div>
                            <div id="tzyinc">
                                <div></div>
                                <p>附件设置隐藏，需要回复后才能看到！</p>
                            </div>
                            <div id="tzpingf">
                                <p>共<span>2</span>条评分，圣才粮票<span>+10</span></p>
                            </div>
                            <div id="tzpingfxx">

                            </div>
                            <div id="tzpingfxx">

                            </div>
                            <div id="tzpingfxx">

                            </div>
                            <div id="tzhuif">

                            </div>
                            <div id="tzshare">

                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <?php
        }
    }
    mysqli_free_result($res);
    mysqli_close($link);
    ?>
    <!--楼主帖子详情结束-->
    <!--帖子回复			-->
    <?php
    $i=0;
    $link = mysqli_connect("localhost", "root", "") or die("数据连接失败");
    mysqli_set_charset($link, "utf8");
    mysqli_select_db($link, "bbs");
    $sql = " select reply.*,user.userName,userdetail.photo from reply,user,userdetail where reply.uid =user.id and user.id=userdetail.uid and pid={$pid} order by ctime asc";
    $res = mysqli_query($link, $sql);
    if ($res && mysqli_num_rows($res) > 0) {
        while ($rows = mysqli_fetch_assoc($res)) {
            $path = "./../public/home/img/";
            $path = rtrim($path . '/') . '/';
                $i++;

            ?>
            <!--楼主帖子详情结束-->
            <div id="bigdetail">
                <div id="detail">
                    <div id="lzinfo">

                        <div id="lztoux">
                            <div id="uname">
                                <a href="#"><?php echo $rows['userName']; ?></a>
                            </div>
                            <div id="utoux">
                                <img src="<?php echo $path.$rows['photo']?>"/>
                            </div>
                            <div id="ulevel">
                                <a href="#">上士</a><br/>
                                <img src="../public/home/img/jindu.png"/>
                            </div>
                            <div id="uhuiz">
                                <a href="#"><img src="../public/home/img/huiz.png"/></a>
                            </div>
                            <div id="uguanz">
                                <a href="#" class="jia">加关注</a>
                                <a href="#" class="fa">发消息</a>
                            </div>
                        </div>
                    </div>
                    <div id="tzinfo">

                        <div id="tzxiangq">
                            <div id="fttime">
                                <p><?php echo $i. '楼' . date('Y-m-d H:i:s', $rows['ctime']) ?></p>
                                <ul>
                                    <li><a href="#">只看楼主</a></li>
                                    <li><a href="#">倒叙阅读</a></li>
                                    <li><a href="#">使用道具</a></li>
                                </ul>
                            </div>
                            <div id="tzneir">
                                <p><?php echo $rows['content'] ?></p>
                            </div>
                            <div id="tzfenx">
                                <a href="#"><img src="../public/home/img/wechat.png"/></a>
                                <a href="#"><img src="../public/home/img/QQ.png"/></a>
                                <a href="#"><img src="../public/home/img/qzone.png"/></a>
                                <a href="#"><img src="../public/home/img/weibo.png"/></a>
                            </div>
                            <div id="tzyinc">
                                <div></div>
                                <p>附件设置隐藏，需要回复后才能看到！</p>
                            </div>
                            <div id="tzpingf">
                                <p>共<span>2</span>条评分，圣才粮票<span>+10</span></p>
                            </div>
                            <div id="tzpingfxx">

                            </div>
                            <div id="tzpingfxx">

                            </div>
                            <div id="tzpingfxx">

                            </div>
                            <div id="tzhuif">

                            </div>
                            <div id="tzshare">

                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <?php
        }
    }
    mysqli_free_result($res);
    mysqli_close($link);
    ?>
</div>


<div id="clear"></div>
<!--大盒子结束-->

<?php require "./foot/footer.php"; ?>
<!--页面尾结束-->
</body>
</html>